/**
 * CopyRight © 2012 USTC SINOVATE SOFTWARE CO.LTD All Rights Reserved.
 */

package com.cmcc.zysoft.infocollection.service;

import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.cmcc.zysoft.infocollection.dao.NewsPcDao;
import com.cmcc.zysoft.infocollection.model.News;
import com.starit.common.dao.hibernate.HibernateBaseDao;
import com.starit.common.dao.service.BaseServiceImpl;

/**
 * @author 袁凤建
 * <br />邮箱: yuan.fengjian@ustcinfo.com
 * <br />描述: NewsPcService.java
 * <br />版本: 1.0.0
 * <br />日期: 2013-8-13 上午9:46:59
 * <br />CopyRight © 2012 USTC SINOVATE SOFTWARE CO.LTD All Rights Reserved.
 */

@Service
public class NewsPcService extends BaseServiceImpl<News, String> {

	@Resource
	private NewsPcDao newsPcDao;
	
	@Override
	public HibernateBaseDao<News, String> getHibernateBaseDao() {
		return this.newsPcDao;
	}
	
	/**
	 * 获取新闻分页列表信息.
	 * @param keyword 搜索关键字
	 * @param page
	 * @param rows
	 * @return Pagination
	 */
	public Map<String, Object> getNewsList(String keyword, int page, int rows) {
		return this.newsPcDao.getNewsList(keyword, page, rows);
	}
	
	/**
	 * 检查新闻标题是否已经存在.
	 * @param title 新闻标题
	 * @param newsId 新闻ID
	 * @return Boolean(true:存在,false-不存在)
	 */
	public Boolean check(String title, String newsId) {
		List<Map<String, Object>> list = this.newsPcDao.check(title, newsId);
		if(list.isEmpty()) {
			return false;
		}
		return true;
	}
	
	/**
	 * 首页-通知公告.
	 * @param companyId 企业ID
	 * @return List<Map<String, Object>>
	 */
	public List<Map<String, Object>> news(String companyId) {
		return this.newsPcDao.news(companyId);
	}
}